/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FCliente.java
 *
 * Created on 04-02-2011, 04:39:02 PM
 */
package java2jdbc.gui;

import java2jdbc.manager.ManagerCliente;
import java2jdbc.model.Cliente;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Gabriel Bran
 */
public class FCliente extends javax.swing.JFrame {

    DefaultTableModel tableModel = new DefaultTableModel();
    ManagerCliente managerCliente = new ManagerCliente();

    public FCliente() {
        initComponents();
        Integer contadorCliente = 0;
        for (Cliente c : managerCliente.buscarCliente(new Cliente("2"))) {

            contadorCliente++;
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jpanelCliente = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        lbCodigo = new javax.swing.JLabel();
        txCodigo = new javax.swing.JTextField();
        lbNombres = new javax.swing.JLabel();
        txNombres = new javax.swing.JTextField();
        lbPrimerApellido = new javax.swing.JLabel();
        txPrimerApellido = new javax.swing.JTextField();
        lbSegundoApellido = new javax.swing.JLabel();
        txSegundoNombre = new javax.swing.JTextField();
        lbTelefono = new javax.swing.JLabel();
        txTelefono = new javax.swing.JTextField();
        lbDireccion = new javax.swing.JLabel();
        txDireccion = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblClientes = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        btGuardar = new javax.swing.JButton();
        btEditar = new javax.swing.JButton();
        btEliminar = new javax.swing.JButton();
        btCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Mantenimiento de Clientes");

        jPanel2.setLayout(new java.awt.GridLayout(6, 2));

        lbCodigo.setText("Codigo");
        lbCodigo.setMinimumSize(new java.awt.Dimension(50, 16));
        jPanel2.add(lbCodigo);

        txCodigo.setText("jTextField1");
        jPanel2.add(txCodigo);

        lbNombres.setText("Nombres");
        jPanel2.add(lbNombres);

        txNombres.setText("jTextField2");
        jPanel2.add(txNombres);

        lbPrimerApellido.setText("Primer Apellido");
        jPanel2.add(lbPrimerApellido);

        txPrimerApellido.setText("jTextField3");
        jPanel2.add(txPrimerApellido);

        lbSegundoApellido.setText("Segundo Apellido");
        jPanel2.add(lbSegundoApellido);

        txSegundoNombre.setText("jTextField4");
        jPanel2.add(txSegundoNombre);

        lbTelefono.setText("Telefono");
        jPanel2.add(lbTelefono);

        txTelefono.setText("jTextField5");
        jPanel2.add(txTelefono);

        lbDireccion.setText("Direccion");
        jPanel2.add(lbDireccion);

        txDireccion.setText("jTextField6");
        jPanel2.add(txDireccion);

        javax.swing.GroupLayout jpanelClienteLayout = new javax.swing.GroupLayout(jpanelCliente);
        jpanelCliente.setLayout(jpanelClienteLayout);
        jpanelClienteLayout.setHorizontalGroup(
            jpanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanelClienteLayout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(208, Short.MAX_VALUE))
        );
        jpanelClienteLayout.setVerticalGroup(
            jpanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanelClienteLayout.createSequentialGroup()
                .addGap(49, 49, 49)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(15, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Cliente", jpanelCliente);

        tblClientes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tblClientes);

        jPanel1.setLayout(new java.awt.GridLayout());

        btGuardar.setText("Guardar");
        jPanel1.add(btGuardar);

        btEditar.setText("Editar");
        jPanel1.add(btEditar);

        btEliminar.setText("Eliminar");
        btEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btEliminarActionPerformed(evt);
            }
        });
        jPanel1.add(btEliminar);

        btCancelar.setText("Cancelar");
        jPanel1.add(btCancelar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 694, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(71, 71, 71))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btEliminarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btEliminarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FCliente().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btCancelar;
    private javax.swing.JButton btEditar;
    private javax.swing.JButton btEliminar;
    private javax.swing.JButton btGuardar;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JPanel jpanelCliente;
    private javax.swing.JLabel lbCodigo;
    private javax.swing.JLabel lbDireccion;
    private javax.swing.JLabel lbNombres;
    private javax.swing.JLabel lbPrimerApellido;
    private javax.swing.JLabel lbSegundoApellido;
    private javax.swing.JLabel lbTelefono;
    private javax.swing.JTable tblClientes;
    private javax.swing.JTextField txCodigo;
    private javax.swing.JTextField txDireccion;
    private javax.swing.JTextField txNombres;
    private javax.swing.JTextField txPrimerApellido;
    private javax.swing.JTextField txSegundoNombre;
    private javax.swing.JTextField txTelefono;
    // End of variables declaration//GEN-END:variables
}
